import request from "../utils/request.js"


// 获取验证码接口
export function _getMessageCode() {
    return request(
        "/VueHandler/AdminLoginAndRegHandler?action=verification",
        "get"
    );
}

//登录接口
export function _doLogin(data) {
    return request("/VueHandler/AdminLoginAndRegHandler?action=login", "POST", data)
}

//提交验证码接口
export function _uploadMessageCode(veri) {
    return request(
        "/VueHandler/AdminLoginAndRegHandler?action=checkVerification",
        "get", {
            veri: veri,
        }
    );
}

//修改密码接口
export function _doChangePassWord(userPwd, newPwd) {
    return request(
        "/VueHandler/AdminHandler?action=updatepass",
        "POST", {
            userPwd: userPwd,
            newPwd: newPwd
        }
    )
}

//添加管理员接口
export function _addAdmin(mes) {
    return request(
        "/VueHandler/AdminLoginAndRegHandler?action=add",
        "POST", mes
    )
}

//查找管理员接口
export function _finfAdmin(name, page) {
    return request(
        "/VueHandler/AdminHandler?action=show",
        "get", {
            searchText: name,
            pageStart: page
        }
    )
}

//修改管理员接口
export function _changeAdmin(req) {
    return request(
        "/VueHandler/AdminHandler?action=update",
        "POST",
        req
    )
}

//获取管理员数据接口
export function _getAdminInfo(pageStart) {
    return request(
        "/VueHandler/AdminHandler?action=show",
        "get", {
            pageStart: pageStart
        }
    )
}

//删除管理员
export function _delAdmin(tokenId) {
    return request(
        "/VueHandler/AdminHandler?action=delete", "get", {
            tokenId: tokenId,
        }
    )
}